<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/7/23
 * Time: 14:52
 */
namespace app\xueao\controller;

use controller\XueaoAdmin;
use service\MemberService;
use think\Db;

class AccountLog extends XueaoAdmin
{
    public $table='AccountLog';

    public function index()
    {
        $this->title = '积分明细';
        $get = $this->request->get();
        $db = Db::name($this->table);
        if (isset($get['addtime']) && $get['addtime'] !== '') {
            list($start, $end) = explode(' - ', $get['addtime']);
            $db->whereBetween('addtime', [strtotime("{$start} 00:00:00"), strtotime("{$end} 23:59:59")]);
        }
        foreach (['type','mid'] as $v){
            if(isset($get[$v])&&$get[$v]!=''){
                $db->where($v,$get[$v]);
            }
        }
        //组装所有流水分类
        $this->assign('alts',MemberService::ACCOUNT_LOG_TEXT);
        return parent::_list($db->order('id desc'));
    }

}